package com.example.m_kartupay;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;

public class FAQActivity extends Activity {

	 ListView list;
	 String[] faq = {
			      "How to top up?",
			      "Why my balances has not changed after the top up",
			      "How to switch to other account?",
			      "How to use my account in merchant's store?",
			      "Can I use a membership account in other Kartupay merchants",
			      "I want to change my email?",
			      "I've lost my card, What should I do ?",
			      "I forgot my PIN/Password"	      	      
     } ;
	 Integer[] imageId = {
			  R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light,
		      R.drawable.abc_ic_go_search_api_holo_light		   
			
		  };
	 @Override
	  protected void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.faq);
	    ListMenuActivity adapter = new
	    		ListMenuActivity(FAQActivity.this, faq, imageId);
	    list=(ListView)findViewById(R.id.listfaq);
	        list.setAdapter(adapter);
	        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
	                @Override
	                public void onItemClick(AdapterView<?> parent, View view,
	                                        int position, long id) {
	                    Toast.makeText(FAQActivity.this, "You Clicked at " +faq[+ position], Toast.LENGTH_SHORT).show();
	                    String _menu = faq[+position];
	                   // Toast.makeText(MainMenuActivity.this, "You Clicked at " +menu[+ position], Toast.LENGTH_SHORT).show();
	                    
	                    // Buat Switch untuk pemilihan intent
	                    
	                    
	                   switch(_menu)
	                   {
		                   case "How to top up?":
		                	   Intent howto =  new Intent(view.getContext(), WebHowtoActivity.class);
		                	   startActivity(howto);
		                	   break;
		                   
	                   }                  
	                 	                    
	                    
	    				//in.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
	    			    //in.putExtra("kirim", "Hallo Saya dari FirstActivity");
	    			   
	    			    
	                
	                }
	            });
	  }
}
